package com.tenement.service.impl;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tenement.mybatis.dao.PhotoMapper;
import com.tenement.mybatis.entity.Photo;
import com.tenement.service.interfaces.IPhotoService;

@Service("IPhotoService")
public class PhotoServiceImpl implements IPhotoService {

	@Autowired
	private PhotoMapper photoMapper;

	private static final Log logger = LogFactory.getLog(PhotoServiceImpl.class);

	/**
	 * 上传图片,信息发布
	 */
	@Override
	public void uploadImages(List<Photo> photoList) {
		logger.info("【批量上传图片】" + photoList.size());
		for (Photo photo : photoList) {
			photoMapper.uploadImages(photo);
		}
	}

	/**
	 * 根据hPhotoid获取某个房屋的图片
	 */
	@Override
	public List<Photo> getHousePhotoList(String hPhotoid) {
		return photoMapper.getHousePhotosByHphotoid(hPhotoid);
	}

}
